package com.sias.spring;

import com.sias.spring.service.OrderService;
import com.sias.spring.service.UserService;
import com.sias.spring.service.UserServiceImpl;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.lang.reflect.InvocationTargetException;

/**
 * @author 吴文杰
 * @version 1.0
 * @createTime ${YEAR}-${MONTH}-${DAY} $HOUR:$MINUTE:$SECOND
 */
public class Main {
  public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);

    UserService userService = (UserService) context.getBean("userServiceImpl");
    OrderService orderService = (OrderService) context.getBean("orderService");

    // Constructor<AppConfig> constructor = AppConfig.class.getConstructor();
    // constructor.setAccessible(true);
    // AppConfig config = constructor.newInstance();
    // System.out.println(config);


    // orderService.test();
    String test = userService.test("asasdsad");
    System.out.println(test);
  }
}